package com.ruoyi.make.controller;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.utils.PageUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.make.domain.CpProduct;
import com.ruoyi.make.service.CpProductService;
import com.ruoyi.system.api.CodeClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/cp")
public class CpProductController extends BaseController
{
    @Resource
    private CpProductService cpProductService;

    /**查询产品列表*/
    @RequiresPermissions("scdd:cp:cpFind")
    @GetMapping("/cpFind")
    public TableDataInfo findProduct(String cpName){
        startPage();
        List<CpProduct> cpList=cpProductService.findProduct(cpName);
        System.out.println(JSON.toJSONString(getDataTable(cpList)));
        return getDataTable(cpList);
    }

}
